<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<script src="./jquery-3.6.0.js"></script>
<!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"
    integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
<!-- 可选的 Bootstrap 主题文件（一般不用引入） -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap-theme.min.css" integrity="sha384-6pzBo3FDv/PJ8r2KRkGHifhEocL+1X2rVCTTkUfGk7/0pbek5mMa1upzvWbrUbOZ" crossorigin="anonymous"> 

<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"
    integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous">
    </script>
<style>
    input{
        width: 100px;
        height: 30px;
        margin-top: 20px;
    }
    #box{
        width: 300px;
        margin: auto;
    }
    button{
        width: 120px;
        margin-top: 20px;
        margin-left: 80px;
    }
</style>

<body>

            <div class="form-group" id="box">
                <h2>登录</h2>
                <input type="text" class= "form-control"required= "required"placeholder="请输入昵称姓名"><span></span>
                <input type="text" class= "form-control"required= "required"placeholder="请输入姓名"><span></span>
                <input type="text" class= "form-control"required= "required"placeholder="请输入手机号码"><span></span>
                <input type="text" class= "form-control"required= "required"placeholder="请输入邮箱"><span></span>
                <input type="password" class= "form-control"required= "required"placeholder="请输入密码"><span></span>
                <input type="password" class= "form-control"required= "required"placeholder="请确认输入的密码"><span></span>
                <button id="reset" class="btn btn-info">提交</button>
            </div>
            
</body>
<script>
 $(function(){
     $("input:eq(0)").blur(function(){
       var objval=$(this).val()
       var reg = /^[\u4e00-\u9fa5]{0,}$/g
            if (!reg.test(objval)) {
                $("span:eq(0)").html("您输入姓名错误")
                $("span:eq(0)").css("color","red") 
                return false
            } else {
                $("span:eq(0)").html( "您输入的姓名正确") 
                $("span:eq(0)").css("color","green")
                return true
            }
     })
     $("input:eq(1)").blur(function(){
       var objval=$(this).val()
       var reg = /^.{0,}$/g
            if (!reg.test(objval)) {
                $("span:eq(1)").html("您输入昵称姓名错误")
                $("span:eq(1)").css("color","red") 
                return false
            } else {
                $("span:eq(1)").html( "您输入的昵称姓名正确") 
                $("span:eq(1)").css("color","green")
                return true
            }
     })
     $("input:eq(2)").blur(function(){
       var objval=$(this).val()
       var reg =  /^[1](\d{10})$/g
            if (!reg.test(objval)) {
                $("span:eq(2)").html("您输入手机号码错误")
                $("span:eq(2)").css("color","red") 
                return false
            } else {
                $("span:eq(2)").html( "您输入的手机号码正确") 
                $("span:eq(2)").css("color","green")
                return true
            }
     })
     $("input:eq(3)").blur(function(){
       var objval=$(this).val()
       var reg =  /^\w+([-\.]\w+)*@\w+([\.-]\w+)*\.\w{0,}$/
            if (!reg.test(objval)) {
                $("span:eq(3)").html("您输入邮箱地址错误")
                $("span:eq(3)").css("color","red") 
                return false
            } else {
                $("span:eq(3)").html( "您输入的邮箱地址正确") 
                $("span:eq(3)").css("color","green")
                return true
            }
     })
     $("input:eq(4)").blur(function(){
       var objval=$(this).val()
       var reg = /^(?![^a-zA-Z]+$)(?!\d+$)/
            if (!reg.test(objval)||objval.length<6||objval.length>12) {
                $("span:eq(4)").html("您输入的密码错误")
                $("span:eq(4)").css("color","red") 
                return false
            } else {
                $("span:eq(4)").html( "您输入的密码正确") 
                $("span:eq(4)").css("color","green")
                return true
            }
     })
     $("input:eq(5)").blur(function(){
         if($(this).val()== $("input:eq(4)").val()&&$(this).val()){
            $("span:eq(5)").html( "确认成功") 
                $("span:eq(5)").css("color","green")
                return true
         }else{
            $("span:eq(5)").html( "密码确认失败") 
                $("span:eq(5)").css("color","red")
                return false
         }
     })
     $("button").click(function(){
         if($("input").val()){
         alert("登录成功")
         return true
         }else{
             alert("登录失败")
         }
     })
 })
</script>
</html>